#!/bin/sh

# argument 1 is the string need grep
# argument 2 is the filename
# argument 3 is the match count

set -eu
OUT_DIR=/tmp/tidb_tools_test

count=$(grep -F "$1" "$2" | wc -l)

if [ "$count" -ne "$3" ]; then
    echo "TEST FAILED: '$2' DOES NOT CONTAIN '$1' $3 times"
    echo "____________________________________"
    cat "$2"
    echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
    exit 1
fi
